package com.example.xianji.adapter;

import java.util.ArrayList;

import com.example.xianji.R;
import com.example.xianji.bean.YiJi_Class;

import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

public class Province_Adapter extends BaseAdapter {
    private Context mContext;
    private ArrayList<YiJi_Class> list;

    public Province_Adapter(Context mContext, ArrayList<YiJi_Class> list) {
        super();
        this.mContext = mContext;
        this.list = list;
    }

    @Override
    public int getCount() {
        return list.size();
    }

    @Override
    public Object getItem(int position) {
        return position;
    }

    @Override
    public long getItemId(int position) {
        return position;
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        Holder mHolder;
        if (convertView == null) {
            mHolder = new Holder();
            convertView = View.inflate(mContext, R.layout.province_gridview_item, null);
            mHolder.text_province = (TextView) convertView.findViewById(R.id.text_province);
            convertView.setTag(mHolder);
        }

        mHolder = (Holder) convertView.getTag();
        mHolder.text_province.setText(list.get(position).getName());
        return convertView;
    }

    class Holder {
        TextView text_province;
    }
}
